package com.tuanzi.loan.web.bean.family;

import com.tuanzi.loan.business.entity.family.LoanCreditCardInfo;
import com.tuanzi.loan.business.entity.family.LoanNewCreditCardInfo;
import com.tuanzi.loan.core.aspect.Debug;
import com.tuanzi.loan.vo.request.credit.LoanCreditCardInfoRequest;
import com.tuanzi.loan.vo.request.family.LoanNewCreditCardInfoRequest;
import com.tuanzi.loan.vo.response.family.LoanNewCreditCardInfoResponse;
import com.tuanzi.loan.web.configuration.JSFInfoBean;
import com.tuanzi.loan.web.configuration.JSFListingBean;
import com.tuanzi.loan.web.lazy.credit.LoanCreditCardInfoLazyDataModel;
import com.tuanzi.loan.web.lazy.family.LoanNewCreditCardInfoLazyDataModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.faces.bean.ViewScoped;

/**
 * User: liangZongXi
 * Create time: 17:38 2018/8/31
 * Description:
 */
@Data
@Debug
@Component
@ViewScoped
@EqualsAndHashCode(callSuper = true)
public class LoanNewCreditCardInfoListBean extends JSFListingBean<LoanNewCreditCardInfoRequest, LoanNewCreditCardInfoResponse> {
    private static final long serialVersionUID = -1256410663791252470L;


    @PostConstruct
    private void init() {
        initLazyDataModel();
    }

    private void initLazyDataModel() {
        $ = new LoanNewCreditCardInfoRequest();
        lazyDataModel = new LoanNewCreditCardInfoLazyDataModel($);
    }

    public void onRest(){
        initLazyDataModel();
    }

    public String toInfo(Long id){
        return  redirect("/views/family/credithousekeeper/credit-card-info.xhtml?id=" +id);
    }

    public String add(){
        return redirect("/views/family/credithousekeeper/credit-card-info.xhtml");
    }
}
